package mvp;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.example.list.R;

import java.util.Observable;
import java.util.concurrent.TimeUnit;

public class MVPActivity extends AppCompatActivity  implements MvpContract.IView{

    private LoginPresent loginPresent;
    private EditText et_name;
    private EditText et_pwd;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mvp);


        loginPresent = new LoginPresent(this);
        et_name = (EditText) findViewById(R.id.mvpa_et_name);
        et_pwd = (EditText) findViewById(R.id.mvpa_et_pwd);

    }

    @Override
    public void Loading() {


    }

    @Override
    public void DismissLoading() {

    }

    @Override
    public void loadSuccess(String str) {
        Toast.makeText(this, str, Toast.LENGTH_SHORT).show();

    }

    @Override
    public void loadFailed(String str) {
        Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
    }

    public void login(View view) {
        String name=et_name.getText().toString();
        String pwd=et_pwd.getText().toString();
        loginPresent.login(name,pwd);
    }
}
